<template>
	<el-form  :model="exitform" label-width="80px">
	
		
		
		
		<el-form-item label="退住类型">
			<el-select v-model="exitform.exitType" placeholder="请选择">
			    <el-option
			      v-for="item in options"
			      :key="item.value"
			      :label="item.lablel"
			      :value="item.value">
			    </el-option>
			  </el-select>
		</el-form-item>
		<el-form-item label="退住原因">
			<el-input v-model="exitform.exitReason"></el-input>
		</el-form-item>

		<el-form-item label="申请时间">
			<el-input v-model="exitform.applyTime"></el-input>
		</el-form-item>
	
		<el-form-item label="备注">
			<el-input v-model="exitform.remark"></el-input>
		</el-form-item>
		
		
		<el-button type="primary" @click="doExitEdit">提交</el-button>
	</el-form>
</template>

<script>
	
	export default{
		name:'ExitEdit',
		props:{
			formData:{
				type:Object,
				default:()=>({})
			},
			editVisible:{
				type:Boolean,
			}
		},
		data(){
			return {
				options: [{
				          value: '正常退住',
				          label: '正常退住'
				        }, {
				          value: '保留床位',
				          label: '保留床位'
				        }, {
				          value: '死亡退住',
				          label: '死亡退住'
				        }],
				exitform:{
					patientId:'',
					exitType:'',
					exitReason:'',
					applyTime:'',
					remarks:'',
					
				rules: {
				      patientId: [
				        { required: false, message: '无法更改', trigger: 'blur' },
				      ]
				      
					
				    }
	
																		}
			}
		},
		mounted(){
					this.exitform=this.formData;
					console.log("子组件数据:");
					console.log(this.exitform)
				},
		methods:{
			doExitEdit(){
				console.log(this.exitform);
				this.postRequest("/exit-registrate/update",this.exitform).then(resp=>{
					if(resp){
						this.$emit("update:editVisible",false);
					}else{
						Message.error({message:'保存失败'});
					}
				})
			}
		},
		watch:{
			formData:{
				deep:true,
				handler(newVal,oldVal){
					this.exitform=newVal
				}
			}
		}
	}
</script>

<style>
</style>
